<template>
  <div class="wrapper">
  	<swiper :options="swiperOption" v-if="showSwiper">
    <!-- slides -->
	    <swiper-slide v-for="item of list" :key="item.id">
	    		<img class="swiper-img" :src="item.imgUrl"/>
	    </swiper-slide>
	    <!--显示分页-->
	    <div class="swiper-pagination"  slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
export default {
  name: 'HomeSwiper',
  props:{
  	list:Array
  },
  data () {
  	return {
		swiperOption: {
			loop:true,
			pagination:'.swiper-pagination'
		}
  	}
  },
  computed:{
  	showSwiper(){
  		return this.list.length
  	}
  }
}
</script>

<style lang="stylus" scoped>
    /*样式穿透,不受scoped影响*/
	.wrapper >>> .swiper-pagination-bullet-active
			background:#fff !important
	.wrapper
		width:100%
		height:0
		overflow:hidden
		padding-bottom:29.6%
		background:#eee
		.swiper-pagination-bullet-active
			background:red !important
		.swiper-img
			width:100%
</style>